using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Net.Mail;
using BLL;
using DTO;

    public partial class Contact : BasePage
    {
        private void Page_Load(object sender, System.EventArgs e)
        {
            
        }
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            BLL.Faq.Contacts.InsertContact(txtAddress.Text, txtPhone.Text, txtEmail.Text, txtSubject.Text, txtBody.Text, DateTime.Now, txtName.Text, "",false);
            try
            {
                string[] usernames = Roles.GetUsersInRole("Administrators");
                foreach (string username in usernames)
                {
                    MembershipUser user = Membership.GetUser(username);
                    Helpers.SendMail(txtName.Text, txtEmail.Text, user.Email, txtSubject.Text, txtBody.Text);
                }
            }
            catch { }
            lblFeedbackOK.Visible = true;
            txtName.Text = "";
            txtEmail.Text = "";
            txtSubject.Text = "";
            txtBody.Text = "";
            txtPhone.Text = "";
            txtAddress.Text = "";
        }
    }
